//-------------------------------------------------------------------------
//   Copyright 2002-2022 National Technology & Engineering Solutions of
//   Sandia, LLC (NTESS).  Under the terms of Contract DE-NA0003525 with
//   NTESS, the U.S. Government retains certain rights in this software.
//
//   This file is part of the Xyce(TM) Parallel Electrical Simulator.
//
//   Xyce(TM) is free software: you can redistribute it and/or modify
//   it under the terms of the GNU General Public License as published by
//   the Free Software Foundation, either version 3 of the License, or
//   (at your option) any later version.
//
//   Xyce(TM) is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with Xyce(TM).
//   If not, see <http://www.gnu.org/licenses/>.
//-------------------------------------------------------------------------

//-----------------------------------------------------------------------------
//
// Purpose        :
//
// Special Notes  :
//
// Creator        : Rob Hoekstra
//
// Creation Date  : 5/25/01
//
//
//
//
//-----------------------------------------------------------------------------

#ifndef _N_TOP_NODE_H
#define _N_TOP_NODE_H

#include <string>
#include <iosfwd>

#include <N_TOP_fwd.h>
#include <N_UTL_Misc.h>
#include <N_UTL_Graph.h>
#include <N_UTL_Pack.h>

namespace Xyce {
namespace Topo {

//-----------------------------------------------------------------------------
// Class         : Node
// Purpose       : Structure containing minimal info for node lookup
// Special Notes :
// Creator       : Rob Hoekstra, SNL, Parallel Computational Sciences
// Creation Date : 5/18/01
//-----------------------------------------------------------------------------
class Node
{
  friend class Pack<Node>;
  
public:

  // Constructor
  Node(const NodeID & nid = NodeID("", -1), const bool & owned = true)
    :
    nodeID_(nid), owned_(owned)
    { }

  // Destructor
  virtual ~Node() { }

  //--------------------------------------------------------------------
  //Simple copy construction and assignment, autogenerated by compiler
  //--------------------------------------------------------------------

  // Equality operator
  bool operator == (const Node & right) const
  { return (nodeID_ == right.nodeID_); }

  // Non-equality operator
  bool operator != (const Node & right) const
  { return (nodeID_ != right.nodeID_); }

  // Get the node ID.
  const NodeID & nodeID() const { return nodeID_; }

  bool & owned() { return owned_; }

  Graph * & graph() { return graph_; }

protected:
  NodeID nodeID_;
  bool owned_;

  Graph * graph_;

  virtual std::ostream & put(std::ostream & os) const;
  friend std::ostream & operator << (std::ostream & os, Node & node);

};

} // namespace Topo
} // namespace Xyce

#endif
